/*定义一个人员类Person，包含数据成员：姓名、ID。
在此基础上派生出学生类Student(增加成绩属性)
和老师类Teacher(增加教龄)，
主函数测试实现对学生和老师信息的输入输出。*/
#include <iostream>
using namespace std;

class Person
{
private:
    string name;
    int ID;
public:
    Person(string name,int ID)
    :name(name),ID(ID){}
    ~Person(){}
    string getName()
    {
        return name;
    }
    int getID()
    {
        return ID;
    }
};

class Student : public Person
{
private:
    float score;
public:
    Student(string name,int ID,float score)
    :Person(name,ID),score(score){}
    ~Student(){}
    float getScore()
    {
        return score;
    }
};

class Teacher : public Person
{
private:
    int age;
public:
    Teacher(string name,int ID,int age)
    :Person(name,ID),age(age){}
    ~Teacher(){}
    int getAge()
    {
        return age;
    }
};

int main(int argc,char*argv[])
{
    Student stu1("he",123,90);
    Teacher tec1("wang",321,5);
    cout<<"stu:"<<stu1.getName()<<endl<<stu1.getID()<<endl<<stu1.getScore()<<endl;
    cout<<"tec1:"<<tec1.getName()<<endl<<tec1.getID()<<endl<<tec1.getAge()<<endl;
    return 0;
}